// created by noellynch
// Jun 3, 2009

package com.sceneworker.monitorpopup.panels;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.concurrent.Callable;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;

import com.jme.util.GameTaskQueueManager;
import com.myjavautils.swing.SwingComponentFactory;
import com.sceneworker.app.globals.cacheobjects.RenderToTextureCacheObject;
import com.sceneworker.editors.colorrgbaeditor.ColorRGBAEditorPanel;

public class ModifyRTTBackgroundColourPanel extends JPanel {

	public	ModifyRTTBackgroundColourPanel(final RenderToTextureCacheObject cl_render, final JDialog cl_dlg) {
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		final	ColorRGBAEditorPanel		lcl_colourPanel = new ColorRGBAEditorPanel(cl_render.mcl_rtt.getBackgroundColor(), false, "Background Colour");
		add(lcl_colourPanel);
		
		JButton		lcl_apply = SwingComponentFactory.makeAButton("Done");
		lcl_apply.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GameTaskQueueManager.getManager().update(new Callable<Void>() {
					public Void call() throws Exception {
						cl_dlg.setVisible(false);
						return null;
					}
				});
			}
		});
		add(lcl_apply);
		
	}
}
